﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassStruct
{
    struct SampleStruct : IEquatable<SampleStruct>, IEquatable<SampleClass>
    {
        public string S { get; set; }
        public int I { get; set; }

        public override int GetHashCode()
        {

            return S.GetHashCode() + I.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if (obj.GetType() == this.GetType() || obj.GetType() == System.Type.GetType("ClassStruct.SampleClass"))
            {
                return obj.GetHashCode() == this.GetHashCode();
            }
            else
            {
                return false;
            }
        }
    }
}
